<div class="sm-pop">
    <table id="list_table" class="layui-hide" lay-filter="mainList"></table>
</div>
<script>
    $(function () {
        layui.use(['layer', 'table', "laydate"], function () {
            var upload=layui.upload;
            var layer = layui.layer;
            var table = layui.table;
            var laydate = layui.laydate;

            var tableObj;
            //日期选择
            laydate.render({
                elem: '#video_time',
                range: true,
                done: function (value, date, endDate) {
                    if (value) {
                        $("#list_form input[name='start']").val(value.substring(0, 10));
                        $("#list_form input[name='end']").val(value.substring(13));
                    } else {
                        $("#list_form input[name='start']").val("");
                        $("#list_form input[name='end']").val("");
                    }
                }
            });

            var player = null;


            smartAui.loadJs("/js/plugin/audiojs/audio.min.js", function () {
                tableObj = table.render({
                    id: 'list_table',
                    elem: '#list_table',
                    url: '/mediaFile/list?mediaType=voice',
                    align: "center",
                    done: function () {
                        console.log("done");
                        audiojs.createAll();
                    },
                    cols: [[
                        {type: 'checkbox'},
                        {type: 'numbers', title: '序号', width: 50},
                        {field: 'title', title: '标题', width: 200, align: 'center',},
                        {field: 'createTime', title: '上传时间', width: 200, align: 'center',},
                        {
                            field: 'lock', title: '操作', align: 'center', templet: function (d) {
                            return '<audio src="' + d.uploadUrl + '"></audio>'
                                + '<a class="font-danger" lay-event="" href="' + d.uploadUrl + '" download="' + d.uploadUrl.substring(d.uploadUrl.lastIndexOf('/') + 1) + '" ><i class="iconfont icon-icondownload"></i> 下载</a>'
                        }, unresize: true, align: 'center'
                        }
                    ]],
                });
            });
        });
    });
</script>